package com.groupnections.server.database.liveFeed;

import java.util.Date;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.groupnections.server.database.ObjectifyServiceCreation;
import com.groupnections.shared.Entity;
import com.groupnections.shared.LiveFeed;

public class SaveLiveFeed {

	public static LiveFeed loadLiveFeed(String entityIDFrom, String entityIDTo,
			String feedDescription) {

		LiveFeed liveFeed = new LiveFeed();

		liveFeed.setLiveFeedDate(new Date());
		liveFeed.setEntityDescription(feedDescription);

		liveFeed.setEntityFrom(new Key<Entity>(Entity.class, entityIDFrom));

		liveFeed.setEntityTo(new Key<Entity>(Entity.class, entityIDTo));

		return liveFeed;
	}

	public static LiveFeed addNew(LiveFeed liveFeed) {

		Objectify objfyService = ObjectifyServiceCreation.gerService();

		objfyService.put(liveFeed);

		return liveFeed;
	}
}